package io.sk.controller;


import io.sk.common.BaseController;
import io.sk.common.base.BaseResult;
import io.sk.common.utils.CheckDataUtils;
import io.sk.service.PersonnelService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 人员信息
 *
 * @author xubinren
 * @version 1.0
 * @date 2018/5/9 16:15
 */
@RestController
@RequestMapping("personnel")
@Api(tags = "人员信息接口")
public class PersonnelController extends BaseController {

    @Autowired
    private PersonnelService personnelService;

    /**
     * @param id          主键id
     * @param avatar      头像
     * @param certificate 教师资格证图片：逗号隔开
     * @return BaseResult
     */
    @PostMapping("/certificate")
    @ApiOperation("教师认证")
    public BaseResult certificate(String id, String avatar, String certificate) {

        //数据验证
        if (CheckDataUtils.isAnyEmptyString(id, avatar, certificate)) {
            return sendResult400();
        }

        //认证
        return personnelService.certificate(id.trim(), avatar.trim(), certificate.trim());
    }

}
